/**
 * 
 */
package com.lehecai.core.api.user;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import com.lehecai.core.api.AbstractApiResultBean;

/**
 * 提款黑名单
 * @author He Wang
 *
 */
public class WithdrawBlacklist extends AbstractApiResultBean {
	public static final String QUERY_TYPE = "type";
	public static final String QUERY_DETAIL = "desc";
	
	public static final String SET_TYPE = "type";
	public static final String SET_DETAIL = "desc";
	public static final String SET_REMARK = "remark";

	
	private WithdrawBlacklistType type;			//黑名单类型
	private String detail;			    //详细
	private String remark;//备注


	public static WithdrawBlacklist convertFromJSONObject(JSONObject object) {
		if (object == null) {
			return null;
		}
		WithdrawBlacklist blacklist = new WithdrawBlacklist();
		int type = getInt(object, "type");
		blacklist.setType(WithdrawBlacklistType.getItem(type));
		blacklist.setDetail(getString(object, "desc"));
		blacklist.setRemark(getString(object, SET_REMARK));
		return blacklist;
	}
	
	public static List<WithdrawBlacklist> convertFromJSONArray(JSONArray array) {
		if (array == null) {
			return null;
		}
		List<WithdrawBlacklist> list = new ArrayList<WithdrawBlacklist>();
		for (Iterator<?> iterator = array.iterator(); iterator.hasNext();) {
			JSONObject object = (JSONObject) iterator.next();
			list.add(convertFromJSONObject(object));
		}
		return list;
	}

	public void setType(WithdrawBlacklistType type) {
		this.type = type;
	}

	public WithdrawBlacklistType getType() {
		return type;
	}

	public void setDetail(String detail) {
		this.detail = detail;
	}

	public String getDetail() {
		return detail;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
}
